package com.ymatou.iapi.cardservice.parameter;

public enum BizCodeEnum {

    Payment(100101, "订单支付"),

    Refund(100201, "订单取消");


    private int code;

    private String message;

    BizCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }



    public static BizCodeEnum getByCode(int code) {
        for (BizCodeEnum statusCodeEnum : BizCodeEnum.values()) {
            if (statusCodeEnum.getCode() == code) {
                return statusCodeEnum;
            }
        }
        return null;
    }


    public static BizCodeEnum getByName(String name) {
        for (BizCodeEnum statusCodeEnum : BizCodeEnum.values()) {
            if (statusCodeEnum.name().equalsIgnoreCase(name)) {
                return statusCodeEnum;
            }
        }
        return null;
    }

  
    public static BizCodeEnum getValue(String value) {
        if (value == null)
            return null;
        value = value.trim();
        for (BizCodeEnum statusCodeEnum : BizCodeEnum.values()) {
            if (statusCodeEnum.name().equalsIgnoreCase(value) || String.valueOf(statusCodeEnum.getCode()).equalsIgnoreCase(value)) {
                return statusCodeEnum;
            }
        }
        return null;
    }
}
